var Md5 = require('../../utils/md5.js');
var timeSecond = Math.floor(Date.now() * 0.001);  //获取时间戳: 
var SignInfoData = Md5.hexMD5(timeSecond + 'nativetalk')//md5加密;
var httpFile = 'http://file.waijiaojun.com/';
const app = getApp();
var httpNativetalk = app.globalData.httpNativetalk;
var httpWeike = app.globalData.httpWeike;
Page({
  data:{
    httpNativetalkFile: 'http://file.waijiaojun.com/',   
    imgUrl: 'http://file.waijiaojun.com/waijiaojun/icon', 
  },
  onLoad:function(e){  
    var that=this; 
    wx.request({
      url: httpWeike + '/v4.2/student/find/weike',
      data: {         
        "category_id": e.dicId,
      },
      header: {//请求头
        "Timestamp": timeSecond,
        "SignInfo": SignInfoData,
        "content-Type": "application/json",
        "client_type": "3",
        "version": 15,
        "token": '',
      },
      method: 'POST',
      success: function (res) {
        console.log(res);        
        var weikeData = res.data.obj.data;
        // var weikeid;
        for (var i = 0; i < weikeData.length;i++){
          weikeData[i].weikeid = weikeData[i].weikeId;
        }
        that.setData({
          allClassList: res.data.obj.data,
        })
      },
      fail: function (res) { },
      complete: function (res) { },
    })
   
  },
  classDetailFun:function(e){
    console.log(e)
    var weikeIds = e.currentTarget.dataset.weikeid;
    wx.navigateTo({
      url: '/pages/systemClass/systemClass?weikeId=' + weikeIds,
    })
  },
})